#!/bin/bash

CWD=`readlink -f .`
GENES=/home/xubx/Research/GSE89230/genes.gff
cd $1
bamCoverage --bam ddup.bam --skipNonCoveredRegions \
    -o positive.bw -of bigwig --binSize 1 --Offset 1 --samFlagInclude 82 &

bamCoverage --bam ddup.bam --skipNonCoveredRegions \
    -o negative.bw -of bigwig --binSize 1 --Offset 1 --samFlagInclude 98 &

htseq-count -q -f bam -r pos -s reverse -t gene -i gene_id ddup.bam ${GENES} > genes_rf.txt & 
htseq-count -q -f bam -r pos -s yes -t gene -i gene_id ddup.bam ${GENES} > genes_fr.txt &

wait

cd $CWD
